1/25/2021

Instructions

Create a web page presentation using R Markdown that features a plot created with Plotly. Host your webpage on either GitHub Pages, RPubs, or NeoCities. Your webpage must contain the date that you created the document, and it must contain a plot created with Plotly. We would love to see you show off your creativity!

The rubric contains the following two questions:

  1. Does the web page feature a date and is this date less than two months before the date that you’re grading this assignment?
  2. Is the web page a presentation and does it feature an interactive plot that appears to have been created with Plotly?

Load and Prepare Data

library(plotly)
data <- diamonds[sample(nrow(diamonds), 2500), 
                 c("carat", "price", "clarity", "depth")]
summary(data)
     carat            price          clarity        depth      
 Min.   :0.2200   Min.   :  335   SI1    :633   Min.   :52.20  
 1st Qu.:0.3900   1st Qu.:  921   VS2    :569   1st Qu.:61.00  
 Median :0.7000   Median : 2400   SI2    :427   Median :61.90  
 Mean   :0.7941   Mean   : 3944   VS1    :348   Mean   :61.73  
 3rd Qu.:1.0300   3rd Qu.: 5333   VVS2   :241   3rd Qu.:62.50  
 Max.   :4.5000   Max.   :18788   VVS1   :161   Max.   :70.50  
                                  (Other):121                  

Create 2D and 3D Scatter Plots

p1 <- plot_ly(data, x = ~carat, y = ~price, color = ~carat,
        size = ~carat, text = ~paste("Clarity: ", clarity))

p2 <- plot_ly(data, x = ~carat, y = ~price, z = ~depth,
        color = ~carat, size = ~carat, 
        text = ~paste("Clarity: ", clarity)) 

Show 2D Scatter Plot

Show 3D Scatter Plot

Thank You